<%--Created by IntelliJ IDEA.
User: admin
Date: 2017/4/12
Time: 10:48
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--解析表达式--%>
<%@ page isELIgnored="false" %>
<%--引入jstl--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--引入springMVC form--%>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="page" uri="/xianzhiOA/pageTag" %>
<%@ taglib prefix="p" uri="/xianzhiOA/powerTag" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <!-- Basic -->
    <meta charset="UTF-8"/>
    <title>项目一览</title>
    <script type="application/javascript">
        function edit() {
            document.getElementById("projectForm").action = "${pageContext.request.contextPath}/Project/projectEdit.emp";
            document.getElementById("projectId").value = null;
            document.getElementById("projectForm").submit();
        }
        function pToSub(page) {
            if(page!=undefined){
                var pageInp = document.getElementById("page");
                pageInp.value = page;
                var form = document.getElementById("projectForm");
                form.submit();
            }
        }
        function deleteCheck(id) {
            if (confirm("确定要删除吗")) {
                window.location.href = "${pageContext.request.contextPath}/Project/deleteProject.emp?projectId="+id;
            }
        }
    </script>
</head>
<body>
<!--头部开始-->
<jsp:include page="headerBack.jsp"></jsp:include>
<!-- 导航 -->
<jsp:include page="leftBack.jsp"></jsp:include>
<!--内容页-->
<div class="main">
    <!--内容页头部-->
    <div class="page-header">
        <div class="pull-left">
            <ol class="breadcrumb visible-sm visible-md visible-lg">
                <li><a href="${pageContext.request.contextPath}/Login/goHomePage"><i class="icon fa fa-home"></i>主页</a></li>
                <li class="active"><i class="fa fa-pencil"></i>基本信息</li>
            </ol>
        </div>
        <div class="pull-right">
            <h2>主页</h2>
        </div>
    </div>
    <!--form表单-->
    <sf:form id="projectForm" action="${pageContext.request.contextPath}/Project/selProjectAll.emp" modelAttribute="project"
             method="post" class="search1">
        <input type="hidden" id="page" name="page" value="${page}"/>
        <input type="hidden" id="pages" name='pages' value="${pages}"/>
        <c:if test="${msg != null}"><h3 style="color: #0FB492">${msg}</h3></c:if>
        <sf:input type="hidden" path="projectId"/>
        <div style="height: 40px">
        <p:power jspPower="项目：添加">
            <button onclick="edit()" type="button" class="three btn btn-primary">添加</button>
        </p:power>
            <a href="${pageContext.request.contextPath}/Project/selProjectAll.emp" class="three btn btn-primary">重置</a></div>
        <sf:input style="width: 150px" path="projectName" type="text" placeholder="按项目名称搜索..."/>
        <span><sf:errors path="projectName"/></span>
        <sf:input style="width: 150px" type="hidden" id="projectOfficial" path="projectOfficial"/>
        <sf:input style="width: 150px" type="text" path="official" placeholder="按负责人搜索..."/>
        <sf:input style="width: 150px" type="text" path="audit" placeholder="按审核人搜索..."/>
        <input style="width: 120px" class="sang_Calender" name="begin" type="text" value="${begin}" placeholder="创建时间...">~
        <input style="width: 120px" class="sang_Calender" name="end" type="text" value="${end}" placeholder="创建时间...">
        <button type="submit" class="one"><span class="fa fa-search"></span></button>
    </sf:form>
    <c:if test="${projectList.isEmpty()}"><h3 style="text-align: center">项目信息不存在</h3></c:if>
    <c:if test="${!projectList.isEmpty()}">
        <!--表格-->
        <div class="well">
            <!--查询-->
            <table class="table" id="now">
                <thead>
                <tr>
                    <th class="vvv">项目名称</th>
                    <th class="vvv">负责人</th>
                    <th class="vvv">审核人</th>
                    <th class="vvv">创建时间</th>
                    <th class="vvv">项目描述</th>
                    <p:power jspPower="项目：删除">
                        <th class="vv">删除</th>
                    </p:power>
                    <p:power jspPower="项目：删除">
                        <th class="vv">修改</th>
                    </p:power>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="p" items="${projectList}">
                    <tr>
                        <td>${p.projectName}</td>
                        <td>${p.emp.empName}</td>
                        <td>${p.emp1.empName}</td>
                        <td><fmt:formatDate type="both" value="${p.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                        <td>${p.projectDescribe}</td>
                        <p:power jspPower="项目：删除">
                            <td>
                                <a onclick="deleteCheck(${p.projectId})" role="button" data-toggle="modal"><i
                                        class="fa fa-times"></i></a>&nbsp;
                            </td>
                        </p:power>
                        <p:power jspPower="项目：修改">
                            <td>
                                <a href="${pageContext.request.contextPath}/Project/projectEdit.emp?projectId=${p.projectId}">
                                    <i class="fa fa-pencil"></i></a>
                            </td>
                        </p:power>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </c:if>
    <c:if test="${pages > 1}">
        <div style="float: right">
            <ul class="pagination">
                <page:paging length="10" page="${page}" pages="${pages}"/>
            </ul>
        </div>
    </c:if>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/dist/backEnd/js/datetime.js"></script>
</body>
</html>